package com.gss.armory.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.validator.constraints.NotBlank;

@Entity
@Table(name="DOC_CATEGORY_DTLS")
public class DocumentCategoryDTO implements Serializable {
	
	private Integer dcId;
	@NotBlank
	private String dcName;
	@NotBlank
	private String dcCode;
	private List<DocumentSubCategory> dcSubCatList = new ArrayList<DocumentSubCategory>();
	private DocumentTypeDTO dcParentType;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="DOC_CAT_ID")
	public Integer getDcId() {
		return dcId;
	}
	@Column(name="DOC_CAT_NAME",nullable=false,length=101)
	public String getDcName() {
		return dcName;
	}
	@Column(name="DOC_CAT_CODE",nullable=false,length=21)
	public String getDcCode() {
		return dcCode;
	}
	@OneToMany(targetEntity=DocumentSubCategory.class,mappedBy="dscParentCategory")
	@LazyCollection(value=LazyCollectionOption.FALSE)
	public List<DocumentSubCategory> getDcSubCatList() {
		return dcSubCatList;
	}
	@ManyToOne(targetEntity=DocumentTypeDTO.class)
	@JoinColumn(name="DOC_CAT_PARENT_TYPE")
	public DocumentTypeDTO getDcParentType() {
		return dcParentType;
	}
	public void setDcId(Integer dcId) {
		this.dcId = dcId;
	}
	public void setDcName(String dcName) {
		this.dcName = dcName;
	}
	public void setDcSubCatList(List<DocumentSubCategory> dcSubCatList) {
		this.dcSubCatList = dcSubCatList;
	}
	public void setDcParentType(DocumentTypeDTO dcParentType) {
		this.dcParentType = dcParentType;
	}
	public void setDcCode(String dcCode) {
		this.dcCode = dcCode;
	}
	
}
